/*
 * @Description: 提交表单的DTO
 */
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, IsString, IsObject } from 'class-validator';

export class SubmitFormDto {
  @ApiProperty({ description: '表单模板ID' })
  @IsNotEmpty({ message: '表单模板ID不能为空' })
  @IsString({ message: '表单模板ID必须为字符串' })
  formTemplateId: string;

  @ApiProperty({ description: '提交的表单数据' })
  @IsNotEmpty({ message: '表单数据不能为空' })
  @IsObject({ message: '表单数据必须为对象' })
  formData: Record<string, any>;

  @ApiProperty({ description: '提交者IP地址', required: false })
  @IsOptional()
  @IsString({ message: '提交者IP必须为字符串' })
  submitterIp?: string;

  @ApiProperty({ description: '提交者用户代理', required: false })
  @IsOptional()
  @IsString({ message: '用户代理必须为字符串' })
  userAgent?: string;

  @ApiProperty({ description: '提交者ID（如果已登录）', required: false })
  @IsOptional()
  @IsString({ message: '提交者ID必须为字符串' })
  submitterId?: string;

  @ApiProperty({ description: '提交来源', required: false })
  @IsOptional()
  @IsString({ message: '提交来源必须为字符串' })
  source?: string;
}